import 'package:dio/dio.dart';
const leading="category";
// 获取所有分类
Future<Response<dynamic>> getAllCategories({required Dio dio}) async {
  Response<dynamic> response = await dio.post('/$leading/all');
  return response;
}

// 添加分类
Future<Response<dynamic>> addCategory({
  required Map<String, String> category,
  required Dio dio,
}) async {
  Response<dynamic> response = await dio.post('/$leading/add', data: category);
  return response;
}

// 删除分类 by 名称
Future<void> deleteCategoryByName({
  required String name,
  required Dio dio,
}) async {
  await dio.post('/$leading/delete', data: {'name': name});
}

// 更新分类
Future<Response<dynamic>> updateCategory({
  required Map<String, dynamic> category,
  required Dio dio,
}) async {
  Response<dynamic> response =
      await dio.post('/$leading/update', data: category);
  return response;
}
